package com.xiaoshuidi.cloud.module.contract.enums.contract;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * 租客APP弹窗类型的枚举类
 *
 * @author 合房源码
 */
@Getter
@AllArgsConstructor
public enum RenterAppDialogTypeEnum {

    SIGNING_CONTRACT(1, "待签约合同"),
    PAYING_ORDER(2, "待支付账单"),
    SIGNING_SECURITY_PROTOCOL(3, "待签约安全协议"),
    PENDING_DELIVERY(4, "交房待处理"),
    SIGNING_OWNER_CONTRACT(5, "待签约业主合同");
    private Integer code;
    private String msg;

    public static String getMsgByCode(Integer code) {
        if (code == null) {
            return "";
        }
        Optional<String> first = Arrays.stream(RenterAppDialogTypeEnum.values()).filter(s -> s.getCode().intValue() == code).map(s -> s.getMsg()).findFirst();
        if (first.isPresent()) {
            return first.get();
        }
        return "";
    }
}
